home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8508.arc
/
XMTBL.C
< prev
Wrap
Text File
|
1986-09-14
|
1KB
|
71 lines
/* xmtbl.c - transmit chars test - Blaise version */
#include "stdio.h"
#include "asynch_1.h"
#define CARD 2
char combuf[1150] ;
int nerr = 0 ;
FILE *fopen() ;
main(argc,argv)
int argc ;
char *argv[] ;
{
int c , err , n , t , speed ;
char b ;
unsigned status ;
FILE *in ;
if( argc < 3 )
{ printf(" no file name on command line \n");
exit(5) ;
}
in = fopen(argv[1],"rb");
if( in == NULL )
{ printf(" can't open input file \n") ;
exit(10) ;
}
sscanf(argv[2],"%d",&speed) ;
init_a1(COM2,speed,2,0,2,&status,&status) ;
err = open_a1(COM2,1000,100,0,0,combuf) ; /* set up for RS-232 use */
send_chr('S') ;
n = 0 ;
eltime() ; /* start timing */
while( (c = fgetc(in) ) != EOF )
{ send_chr(c) ; }
send_chr('Q') ;
t = eltime() ; /* stop timing */
printf(" %d Ticks %8.2f Secs \n",t,( (float) t)/18.2) ;
fclose(in) ;
wait_a1(100) ;
close_a1(COM2) ;
}
int rcv_chr() /* wait for and get next char */
{
int c , err , n ;
char b ;
unsigned status ;
while( (err=rdch_a1(COM2,&b,&n,&status)) != 0)
{ ; }
return( (int) b ) ;
}
int send_chr(c) /* wait and xmt next char */
int c ;
{
while( wrtch_a1(COM2,c) != 0 )
{ ; }
}